package com.cws.controller;

import java.util.Map;

import javax.servlet.http.HttpServletRequest;

import org.springframework.stereotype.Controller;
import org.springframework.ui.ModelMap;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.multipart.MultipartFile;
import org.springframework.web.multipart.MultipartHttpServletRequest;
import org.springframework.web.servlet.ModelAndView;

@Controller
public class UploadController extends BaseController {
	
	@RequestMapping(value="base/upload")
	@ResponseBody
    public ModelMap upload(HttpServletRequest request)throws Exception{
		MultipartHttpServletRequest multiRequest = (MultipartHttpServletRequest)request;
		Map<String, MultipartFile>  fileMap = multiRequest.getFileMap();
		ModelMap result = new ModelMap();
		result.addAttribute("status", "success");
       return result;
    }
	 
	 
 	@RequestMapping(value="/base/uploadPage")
    public ModelAndView uploadPage(HttpServletRequest request){
        
        //如果不用注解自动绑定，我们还可以像下面一样手动获取数据
        
        ModelAndView modelAndView = new ModelAndView("jsp/upload");  
        
        return modelAndView;
    }
	
	
}
